<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml"/>
<head>
	<th:block th:include="include :: header('扫描页面')" />
	<th:block th:include="include :: scan-css" />
	<th:block th:include="include :: datetimepicker-css" />
	<style>
		.sm_bjsw li{
			cursor:pointer;
			width:calc(100% / 9)
		}
	</style>
</head>

<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: JbfImageMng-js" />
<th:block th:include="include :: trans-js" />
<th:block th:include="include :: batchpayScan-js" />
<script th:inline="javascript">
	var prefix = '/sdi/scan';

	var isSubmit = false;
	var g_oImageMng = new CJbfImageMng;
	var g_tran = new YYTrans;
	var arcId = "";          //扫描一批的唯一ID
	var ftpPath = "";        //传输的路径
	var fileStoredType="true";
	var g_submitUrlArgs="";
	var g_TransAgentUrl = "/pab_oms/servlet/HttpAgentFileStoreServlet";    		//http传输的代理地址,此处不包含http://hostnam:port
	var getFtpConnInfoConf = "/ams_cbps/pages/batchpay/scan/FtpConnectInfo";  	//FTP连接信息的加密文件,此处不包含http://hostnam:port
	var g_nTransType = 0;    // 0 是HTTPAGENT,此方式也是默认方式, 1 FTP用于集中点
	var imagesCountOld = 0;
	var servletePath = "";
	var httpServerIp = "";
	var httpServerPort = "";
	var g_scanCenter ="";
	var imageNum = 0;
	var scanType=0;
	//扫描批量提交地址
	var g_submitUrl = prefix+[[${g_submitUrl}]];

	//选择批量的地址以及模式对话框打开时候的参数,是以模式对话框打开
	var g_chooseBatchDialogUrl = prefix+[[${g_chooseBatchDialogUrl}]];
	var g_chooseBatchDialogOpt = [[${g_chooseBatchDialogOpt}]];

	var transFailedFilePath="";
	var windowStatus = "";
	var failedCount=0;
	var upLoadSuccess = "";
	var g_bChoose = false;
	var g_bTransSuccess = false;     //以后需要修改为Cookie的方式
	var g_LocalPath=""; //本地路径
	var g_FileSize=""; //文件大小
	var g_FileNames=""; //文件大小
	var g_TrTeller = "";
	var g_TrDate = "";
	var g_bCanSubmit = false;
	var g_szFailLog = "";
	var g_bAutoSave = 1;
	var g_fileDisk = [[${paeaParaSystem.getFileDisk()}]]
	//function InitPageInfo 里面会调用此方法，就是在初始化页面信息的时候，会初始化全局的参数
	function initGlobalPara()
	{
		arcId = "";
		ftpPath = "";
		transFailedFilePath="";
		windowStatus = "";
		failedCount=0;
		upLoadSuccess = "";
		imageNum = 0;
		checkNum = 0;
		g_bChoose = false;
		g_bTransSuccess = false;     //以后需要修改为Cookie的方式
		g_szFailLog = "";
		g_bCanSubmit = false;
		//getPageParameter();
		//add qiuxbo
		g_oImageMng.SetCommFlag(16,1);
		g_oImageMng.ShowFirstPage();
		document.getElementById("curIndex").value = 0;
		document.getElementById("imgTotal").value = imageNum;
		document.getElementById("statusMsg").value = windowStatus;
		g_TrDate=""; //业务日期
		g_UnitCode=""; //机构
		g_LocalPath=""; //本地路径
		g_FileSize = ""; //文件大小
		g_TrTeller = "";
	}

	function clearGlobalParas()
	{
		arcId = "";
		ftpPath = "";
		transFailedFilePath="";
		windowStatus = "";
		failedCount=0;
		upLoadSuccess = "";
		imageNum = 0;
		checkNum = 0;
		g_bChoose = false;
		g_bTransSuccess = false;     //以后需要修改为Cookie的方式
		g_szFailLog = "";
		g_bCanSubmit = false;
		//getPageParameter();
		g_oImageMng.LoadListImage("");
		g_oImageMng.ShowFirstPage();
		document.getElementById("curIndex").value = 0;
		document.getElementById("imgTotal").value = imageNum;
		document.getElementById("statusMsg").value = windowStatus;
		g_TrDate=""; //业务日期
		//g_UnitCode=""; //机构
		g_LocalPath=""; //本地路径
		g_FileSize = ""; //文件大小
		g_TrTeller = "";
	}

	//选择影像
	function OnSelectImage(nIndex,nCount)
	{
		document.getElementById("curIndex").value = nIndex;
		document.getElementById("imgTotal").value = nCount;

		var fileNameLength = g_oImageMng.GetCurrentImageName().length;
		var fileNameStartPos = g_oImageMng.GetCurrentImageName().lastIndexOf("\\");
		fileName = g_oImageMng.GetCurrentImageName().substr(fileNameStartPos + 1,fileNameLength);
		document.getElementById("curFileName").value = fileName;
		//document.getElementById('IndexInfo').value = "第" + nIndex + "页/共" + nCount + "页"
	}

	function OnTwainScanOneOver(strFileName,nSize,bObversed)
	{
		try{
			//setPageIndex();
		}catch(e) {
			//alert("调用父页面 tallFlashNewFile 出错！");
		}
	}

	//取得票据影像文件的NAME,需要拼接url，记录数据库
	function getFileNames(){

		g_FileNames="";
		g_FileSize = "";

		//获取扫描影像张数
		var count = g_oImageMng.GetImagesCount();
		for(var i=0;i<count;i++){
			var fileNameLength = g_oImageMng.GetImageFileName(i).length;
			var fileNameStartPos = g_oImageMng.GetImageFileName(i).lastIndexOf("\\");
			var fileNameFull = g_oImageMng.GetImageFileName(i) ;
			// g_FileSize = g_FileSize + "," + getFileSize(fileNameFull);


			if(fileStoredType=="true")
			{
				g_FileNames = g_FileNames+"," + ftpPath + "/" + g_oImageMng.GetImageFileName(i).substr(fileNameStartPos + 1,fileNameLength);
			}
			else
			{
				g_FileNames = g_FileNames+"," + fileNameFull;
			}
			//alert(g_FileNames);
		}
		//目的：去除拼接后g_FileNames开头的","
		if(g_FileNames.length>0){
			g_FileNames=g_FileNames.substr(1);
			//  g_FileSize = g_FileSize.substr(1);
		}
		return g_FileNames;
	}

	//批量上传影像，点击提交按钮时调用
	function uploadBatch(){
		// 扫描影像张数
		var count = g_oImageMng.GetImagesCount();;
		// 上传文件
		var sucCount = uploadFileDirect();
		//失败重传
		if(sucCount != count){
			var reSuccessCount = uploadFileDirect();
			sucCount = sucCount + reSuccessCount;

			if(sucCount!= count ){
				$.modal.msgWarning("传输影像张数" + sucCount + "与扫描影像张数" + count + "不一致,请检查网络！");
				//alert(g_szFailLog);
				g_bTransSuccess = false;
				return sucCount;
			}
			else {
				g_bTransSuccess = true;
				return sucCount;
			}
		}
		else {
			g_bTransSuccess = true;
			return sucCount;
		}
	}

	//上传影像文件，点击提交按钮的时候调用
	function uploadFileDirect(){
		var reTransFailedFilePath = transFailedFilePath;
		transFailedFilePath = "";
		failedCount = 0;
		//上传localFilePath目录下所有影像
		var localFilePath=g_LocalPath+"/*.JPG";
		var oldHttpServerIp = httpServerIp;
		var oldHttpServerPort = httpServerPort;

		//var ret = g_oImageMng.PutHttpFiles(oldHttpServerIp,oldHttpServerPort,ftpPath,localFilePath,1);
		var ret = g_tran.PutFile(oldHttpServerIp,oldHttpServerPort,ftpPath,localFilePath,1);
		//说明：ret==""上传成功，否则上传失败
		//if (ret != "")
		//{
		//	return reUploadFailedFileWithFtp();//如果失败转用FTP
		//}else{
		return g_oImageMng.GetImagesCount();
		//}
	}

	//暂时没有被调用
	function OnUploadOnefile(filepath,filesize,nflag){

		if(nflag == 0){
			$.modal.msgWarning("失败文件重新传输:" + filepath + "failedCount=" + failedCount);
			failedCount++;
			transFailedFilePath = transFailedFilePath + filepath + "|";
		}
		if(nflag == -1){
			g_szFailLog = g_szFailLog + " " + filepath;
			//alert("传输出现异常:"+filepath);
		}
		if(nflag == 2){
			$.modal.msgWarning("打开本地文件失败,请检查");
		}
	}


	//回调函数
	function callBackchooseBatch(submitUrlArgs,v_LocalPath,v_arcId,v_ftpPath,v_pageCount,v_otherMsg,v_fRate,v_checkNum, v_trDate,v_scanType)   //选择批量的回调函数
	{
		scanType = v_scanType;
		if(scanType == 0){
			arcId  = "bos....";
		} else {
			arcId = v_arcId;
		}
		ftpPath = v_ftpPath;
		imageNum = v_pageCount;
		checkNum = v_checkNum;
		g_TrDate = v_trDate;
		windowStatus =  v_otherMsg;
		g_submitUrlArgs=submitUrlArgs;
		//alert(v_arcId+"-"+v_ftpPath+"-"+v_batchNo+"-"+v_pageCount+"-"+v_otherMsg )  ;
		document.getElementById("statusMsg").value = windowStatus;
		//根据PAEAPARASystem里得到的盘符来设置本地文件夹的盘符
		if(g_fileDisk != ""){
			g_LocalPath = g_fileDisk + v_LocalPath.substring(1,v_LocalPath.length);
		}else{
			g_LocalPath = v_LocalPath;
		}
		g_oImageMng.SetScanPath(g_LocalPath);
		//g_oImageMng.SetScanDefaultRate(v_fRate);
		g_oImageMng.SetImgResolution(200,200);
		g_oImageMng.SetImgContrast(128);
		g_oImageMng.SetImgBrightness(128);
		g_bTransSuccess = false;
		g_bChoose = true;
		g_bCanSubmit = true;
		g_szFailLog = "";
	}

	function openFileIIs(){
		try{
			var obj=new ActiveXObject("wscript.shell");
			if(g_LocalPath=="null"){
				$.modal.msgWarning("路径不存在，请重新操作！");
				return;
			}else if(obj){
				obj.Run("\""+g_LocalPath+"\"", 1, false );
				obj=null;
			}
		}catch(e){
			$.modal.msgWarning("请确定是否存在该盘符或文件。");
		}
	}
</script>
<body onunload="javascript:CloseImageMng();">
	<div id='nkzcontainer' name='nkzcontainer'></div>
	<div id="divMenu"
		 style="position: absolute; top: 534; left: 0; width: 100%; visibility: hidden;">
		<div style="height: 15px;"></div>
		<div class="sm_bjs">
			<ul>
				<li style="width: 15px;">
					<img id="jiantou" name="jiantou"
						 th:src="@{'/img/scanImg/jts1.gif'}" align="absmiddle" onClick="moveMenu()"
						 style="margin-top: 15px">
				</li>
				<li valign="top" align="center" class="piciBtn">
					<img th:src="@{'/img/scanImg/sm_20.gif'}" align="absmiddle"
						 title="选批次"> 选批次
				</li>
				<li valign="top" align="left" style="width: 2px;">
					<img th:src="@{'/img/scanImg/sxs.gif'}" align="absmiddle">
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_02.gif'}" align="absmiddle"
						 title="扫  描" onclick="scan()">扫 描
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_05.gif'}" align="absmiddle"
						 title="删  除" onclick="IE_Scan.DeleteCurrentFile();">删 除
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_04.gif'}" align="absmiddle"
						 title="插  入" onclick="IE_Scan.InsertScan();"> 插 入
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_21.gif'}" align="absmiddle"
						 title="替　换" onclick="IE_Scan.Rescan();"> 替 换
				</li>
				<li valign="top" align="center">
					<a id="submitBtn1" name="submitBtn1"><img
							th:src="@{'/img/scanImg/sm_16.gif'}" align="absmiddle" title="提  交"
							onclick="submitBatch()"> 提 交</a>
				</li>
				<li valign="top" align="left" style="width: 2px;">
					<img th:src="@{'/img/scanImg/sxs.gif'}" align="absmiddle">
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_01.gif'}" align="absmiddle"
						 title="扫描仪" onclick="IE_Scan.ChoiceScanner();"> 扫描仪
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_03.gif'}" align="absmiddle"
						 title="设  置" onclick="IE_Scan.SetParameters();"> 设 置
				</li>
				<li valign="top" align="center" id="clearAllBtn">
					<img th:src="@{'/img/scanImg/sm_06.gif'}" align="absmiddle"
						 title="清  空"> 清 空
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_08.gif'}" align="absmiddle"
						 title="放  大" onclick="IE_Scan.ZoomOut();"> 放 大
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_07.gif'}" align="absmiddle"
						 title="缩  小" onclick="IE_Scan.ZoomIn();"> 缩 小
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_13.gif'}" align="absmiddle"
						 title="旋  转" onclick="rotateImg(90);"> 旋 转
				</li>
				<li valign="top" align="left" style="width: 2px;">
					<img th:src="@{'/img/scanImg/sxs.gif'}" align="absmiddle">
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_01.gif'}" align="absmiddle"
						 title="显示/隐藏正反面信息"
						 onclick="IE_Scan.SetShowFrontBackIdentity(!IE_Scan.IsShowFrontBackIdentity());">
					正反面
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_09.gif'}" align="absmiddle"
						 title="首  页" onclick="IE_Scan.ShowFirstPage();"> 首 页
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_10.gif'}" align="absmiddle"
						 title="上一页" onclick="IE_Scan.ShowPreviousPage();"> 上一页
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_11.gif'}" align="absmiddle"
						 title="下一页" onclick="IE_Scan.ShowNextPage();"> 下一页
				</li>
				<li valign="top" align="center">
					<img th:src="@{'/img/scanImg/sm_12.gif'}" align="absmiddle"
						 title="尾  页" onclick="IE_Scan.ShowLastPage();"> 尾 页
				</li>
			</ul>
		</div>
	</div>
	<script th:inline="javascript">
		InitLpk();
		var ImageMngWidth = 1280;
		var ImageMngHeight = 800;
		try{
			ImageMngWidth = screen.availWidth - 20;
			ImageMngHeight = screen.availHeight - 180;
		}catch(e){}

		ImageMngWidth = ImageMngWidth > 500 ? ImageMngWidth : 500;
		ImageMngHeight = ImageMngHeight > 300 ? ImageMngHeight : 300;

		g_oImageMng.InitImageMng("JBFImageMng_01",ImageMngWidth,ImageMngHeight);

		g_tran.initTrans(1,1);
	</script>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sm_bjss">
		<tr>
			<td valign="top" align="left" height="10px"><input class="yincang" type="text" id="statusMsg"
															   style="width:550px;text-overflow:ellipsis;" readonly></td>
			<td align="left" width="100%">
				<table>
					<tr>
						<td><input class="yincang" type="hidden" id="curFileName"
								   style="width:100px;text-overflow:ellipsis;" readonly></td>
						<td class="yingcang"><input class="yincang" type="text" id="nkzmsg"
													style="width:150px;text-overflow:ellipsis;" readonly></td>
					</tr>
				</table>
			</td>
			<td align="RIGHT" nowrap="nowrap" id="pageSizeBtn">第<input class="yincang" type="text" id="curIndex"
																	   style="width:35px" align="center" readonly>页/共<input
					class="yincang" type="text" id="imgTotal" style="width:30px" readonly>页
			</td>
		</tr>
		<tr>
			<td valign="top" align="center" colspan="3">
				<div class="sm_bjsw">
					<ul class="list-unstyled">
						<li valign="top" style="" align="center" id="piciBtn" class="piciBtn">
							<a class="btn btn-primary"><img th:src="@{'/img/scanImg/sm_20s.gif'}" align="absmiddle"
															title="选批次"> 选批次
							</a>
						</li>
						<li valign="top" align="center" id="scanBtn">
							<a class="btn btn-info"><img th:src="@{'/img/scanImg/sm_02s.gif'}" align="absmiddle"
														 title="扫  描">扫 描
							</a>
						</li>

						<li valign="top" align="center" id="insertBtn">
							<a class="btn btn-danger"><img th:src="@{'/img/scanImg/sm_784.gif'}" align="absmiddle"
														   title="插  入">插 入
							</a>
						</li>
						<li valign="top" align="center" id="changeBtn">
							<a class="btn btn-default"><img th:src="@{'/img/scanImg/sm_559.gif'}" align="absmiddle"
															title="替　换">替 换
							</a>
						</li>
						<li valign="top" align="center" id="deleteBtn">
							<a class="btn btn-warning"><img th:src="@{'/img/scanImg/sm_667.gif'}" align="absmiddle"
															title="删  除">删 除
							</a>
						</li>
						<li valign="top" align="center" id="submitBtn">
							<a class="btn btn-success"><img th:src="@{'/img/scanImg/sm_16s.gif'}" align="absmiddle"
															title="提  交">提 交(F5)
							</a>
						</li>
					</ul>
				</div>
			</td>
		</tr>
	</table>
	<div style="text-align: center" id="trans"></div>
	<form id="formScanInfo" name="formScanInfo" method="post">
		<input type="hidden" name="arcId" value="" id="arcId">
		<input type="hidden" name="fileNames" value="" id="fileNames">
		<input type="hidden" name="fileSizes" value="" id="fileSizes">
		<input type="hidden" name="localPath" value="" id="localPath">
		<input type="hidden" id="errorMessage" name="errorMessage"/>
	</form>
</body>

<script th:inline="javascript">
	//暂时没有被调用
	function show_01(){
		g_oImageMng.SetScanPath("c:\\JBFScan");
		g_oImageMng.ShowFirstPage();
	}

	//旋转图片
	function rotateImg(fRotate)
	{
		g_oImageMng.Rotate(fRotate);
		if (g_bAutoSave == 1)
		{
			g_oImageMng.SaveAs(g_oImageMng.GetCurrentImageName())
		}
	}

	//去黑边
	function autoTrim(){
		g_oImageMng.AutoTrim(0,20,0,0.01);
		if (g_bAutoSave == 1)
		{
			g_oImageMng.SaveAs(g_oImageMng.GetCurrentImageName())
		}
	}
	//根据页号显示图像--暂时没有被调用
	function showIndexPage(){
		var pageIndex = document.all("pageIndex").value;
		var fileCount = g_oImageMng.GetImagesCount();
		if(pageIndex <= 0 || pageIndex > fileCount) {
			$.modal.msgWarning("没有您输入的存在页数!");
			return;
		}
		if(pageIndex == fileCount) {
			g_oImageMng.ShowLastPage();
		} else {
			g_oImageMng.ShowPageByIndex(pageIndex-1);
		}
	}
	var IE_Scan = g_oImageMng;

	//初始化页面时调用，设置类型
	function SetType(){
		g_oImageMng.obj().Init(1);
	}

	//影像导入的函数，支持从本地导入影像，上传到服务器的功能，一般情况下用不着
	function importImage(){
		if(g_bChoose && g_oImageMng.GetImagesCount() == 0){
			var importPath = g_oImageMng.ChoosePath('影像导入','请选择导入路径',g_oImageMng.obj().ImgGetPathNameForSave());
			if (importPath != "")
			{
				var count = g_oImageMng.ImgImport(importPath,0);
				g_oImageMng.ShowFirstPage();
			}
		}
	}

	//进入扫描页面时，就会执行，目的是初始化页面信息
	function InitPageInfo(){

		if (document.readyState == "complete") {
			g_oImageMng.SetVender("北京京北方科技股份有限公司");
			g_oImageMng.TwainSetDeletefileFlag(1);
			g_oImageMng.SetScanFrontAndBackJPEGQuality(85,50);
			SetType();
			//g_oImageMng.obj().ImgSetType(1);

			initPara();

		}
		else {
			document.onreadystatechange = function(){
				if (document.readyState == "complete") {


					g_oImageMng.SetVender("北京京北方科技股份有限公司");

					SetType();

					initGlobalPara();
					// document.getElementById("divMenu").style.top = g_oImageMng.obj().height;
					g_oImageMng.TwainSetDeletefileFlag(1);
					g_oImageMng.SetScanFrontAndBackJPEGQuality(85,50);
					//g_oImageMng.obj().ImgSetType(1);

					initPara();
				}
			}
		}
	}

	//初始化参数
	function initPara()
	{
		// arcId   = window.dialogArguments.getArcId();
		// ftpPath = window.dialogArguments.getFtpPath();
		// imageNum = window.dialogArguments.getPageCount();
		//网点登记票数
		checkNum = 0;
		// windowStatus = window.dialogArguments.getOtherMsg();
		// servletePath = window.dialogArguments.getServletePath();
		httpServerIp = [[${paeaParaSystem.getFileHttpIp()}]];
		httpServerPort = [[${paeaParaSystem.getFileHttpPort()}]];
		// scanType = window.dialogArguments.getScanType();
		// g_scanCenter = window.dialogArguments.getScanCenter();
		g_chooseBatchDialogUrl = prefix+[[${g_chooseBatchDialogUrl}]];
		// document.getElementById("statusMsg").value = windowStatus;
		// g_LocalPath = window.dialogArguments.getLocalPath();
		g_oImageMng.SetScanPath(g_LocalPath);
		// fileStoredType = window.dialogArguments.getfileStoredType();
		//g_oImageMng.SetScanDefaultRate(v_fRate);
		g_bTransSuccess = false;
		g_bChoose = true;
		g_bCanSubmit = true;
		g_szFailLog = "";
		//正面显示，不加密传输 暂时注释qiuxbo
		//g_oImageMng.SetCommFlag(2,0);
	}

	//选择批次信息
	$("#piciBtn").click(function () {
		scanBatchInfo();
	})
	//扫描
	$("#scanBtn").click(function () {
		scan();
	})
	//插入
	$("#insertBtn").click(function () {
		IE_Scan.InsertScan();
	})
	//替换
	$("#changeBtn").click(function () {
		IE_Scan.Rescan();
	})
	//删除
	$("#deleteBtn").click(function () {
		IE_Scan.DeleteCurrentFile()
	})
	//提交批次
	$("#submitBtn").click(function () {
		submitBatch()
	})

	function scanBatchInfo()
	{
		var returnValue = window.showModalDialog(g_chooseBatchDialogUrl,window,g_chooseBatchDialogOpt);
		if(returnValue)
		{
			//window.dialogArguments.putDialogReturnValue(returnValue);
			var values = returnValue.split("@@@");
			callBackchooseBatch(values[0],values[1],values[2],values[3],values[4],values[5],"",values[6],values[7],values[8])
			return;
		}
	}

	//点击扫描按钮时，触发的function，调用scan组件
	function scan()
	{
		if(arcId=="")
			scanBatchInfo();
		else
			//开始扫描
			IE_Scan.Scan();
	}

	//提交批次
	function submitBatch(){
	    $("#errorMessage").val("")
        $("#scanType").val(scanType);
		if(isSubmit){
			return false;
		}
		isSubmit = true;
		if(imageNum=='undefined' || imageNum==0) {
			$.modal.msg("请先扫描再提交");
			isSubmit = false;
			return;
		}

		if(arcId=="") {
			$.modal.msg("请先选择批次");
			isSubmit = false;
			return;
		}
		var fileNum = g_oImageMng.GetImagesCount();
		//扫描张数、扫描员登记张数、网点登记张数 都不符
		if(scanType==0 && fileNum != imageNum && fileNum!=(checkNum*2)){
			if(confirm("扫描张数: "+fileNum/2+"\n扫描员登记张数: "+imageNum/2+"\n网点登记张数: "+checkNum+"\n是否要将登记的张数变更为"+fileNum/2
					+"\n并创建一条风险？")
			){
				//创建风险
				$("#errorMessage").val("扫描凭证张数、柜员登记张数与主管登记张数不一致,\n扫描张数: "+fileNum/2+";扫描员登记张数: "+imageNum/2+";网点登记张数："+checkNum);
				imagesCountOld = fileNum;
			}else{
				isSubmit = false;
				return false;
			}
		}
		else if(scanType==0 && fileNum != imageNum){ //扫描的影像数量 和 录入的影像数量不符
			if (confirm("扫描张数: "+fileNum/2+"\n登记张数: "+imageNum/2+"\n是否要将登记的张数变更为: "+fileNum/2
					+"\n并创建一条风险？")){
				//创建风险
				$("#errorMessage").val("扫描凭证张数与柜员登记张数不一致，扫描张数:"+fileNum/2+";柜员登记张数: "+imageNum/2);
				imagesCountOld = fileNum;
			}else{
				isSubmit = false;
				return false;
			}

		} else if (scanType==0 && fileNum != (checkNum*2)){   //网点登记票数与扫描票数不符,不用警告，直接登记风险
			$("#errorMessage").val("扫描凭证张数与主管登记张数不一致，扫描张数:"+fileNum/2+";网点登记张数: "+checkNum);

		}
		//step2:提取名称，组建url字符串
		getFileNames();
		if(fileStoredType=="true")
		{
			if (g_bTransSuccess == false){
				var transSuccessCount = uploadBatch();
				if ( transSuccessCount != fileNum){
					$.modal.msgWarning("上传张数："+transSuccessCount/2+"与扫描张数:"+fileNum/2+"不符");
					isSubmit = false;
					return;
				}
			}
		}
	}

	//获取参数信息
	function getPageParameter(){
		try{
			//window.dialogArguments这种写法就是调用父页面scanWelcome.jsp的function，页面之间传参
			// g_TransAgentUrl = window.dialogArguments.getTransAgentUrl();
			// getFtpConnInfoConf = window.dialogArguments.getFtpConnInfoConf();
			// g_nTransType = window.dialogArguments.getTransType();
			g_submitUrl = prefix+[[${g_submitUrl}]];
			g_chooseBatchDialogUrl = [[${g_chooseBatchDialogUrl}]];
			g_chooseBatchDialogOpt = [[${g_chooseBatchDialogOpt}]];
			g_fileDisk = [[${paeaParaSystem.getFileDisk()}]];
		}
		catch(e){
			//alert("no implement!");
		}
	}

	//接收键盘信息
	function doKeyDown(keyCode){
		//alert(keyCode)
		//F2 选择批次
		if(keyCode==113)
		{
			scanBatchInfo();
			return;
		}
		//F3 扫描
		if(keyCode==114)
		{
			scan();
			return;
		}
		//F5 提交
		if(keyCode==116)
		{
			submitBatch();
			event.keyCode=0;
			return false;
		}
		//PgUp 上一页
		if(keyCode==33)
		{
			IE_Scan.ShowPreviousPage();
			return;
		}

		//PgDn 下一页
		if(keyCode==34)
		{
			IE_Scan.ShowNextPage();
			return;
		}
		//F7
		if(keyCode==118)
		{
			window.close();
			return false;
		}
		//F9
		if(keyCode==120)
		{
			openFileIIs();
			return false;
		}
	}

	function OnPutHttpFileFinish(ret, id){
		try{
			var result = new ResultWrapper(ret);
			if(result.isOK()){//传输成功后提交
				var fileNum = g_oImageMng.GetImagesCount();

                $("#fileSizes").val(g_FileSize);
                $("#arcId").val(arcId);

                $("#fileNames").val(g_FileNames);
                $("#localPath").val(g_LocalPath);
				$.operate.post(g_submitUrl,$('#formScanInfo').serialize()+g_submitUrlArgs,function (result) {
					if(result.code == web_status.SUCCESS) {
						$.modal.msgSuccess(result.msg);
							g_oImageMng.SetScanPath("c:\\northking\\archive\\scannedfile\\");
							document.getElementById("statusMsg").value = "";
							document.getElementById("curFileName").value = "";
							document.getElementById("curIndex").value = "";
							document.getElementById("imgTotal").value = "";
							//上传成功后，自动扫描第二批，弹出选择批次的界面
							clearGlobalParas();
							isSubmit = false;
							scanBatchInfo();
					}else{
						isSubmit = false;
					}
				})
			}else{
				//传输失败
				return false;
			}
		}catch(e){
			isSubmit = false;
			$.modal.msgError("调用submitBatch 出错！"+e);
		}
	}

	//关闭窗口的按钮 onunload
	function CloseImageMng(){
		g_oImageMng.Close();
	}

	InitPageInfo();
</script>
